<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>json的解析</title>
</head>
<body>

</body>
<script type="text/javascript">
    var json={
        "people":[
            {
                "firstName" : "Brett",
                "lastName" : "McLaughlin"
            },
            {
                "firstName" : "Jason",
                "lastName" : "Hunter"
            }
        ]
    };
    var people = json = json.people;
    for (let i = 0; i <  people.length;i++) {
        console.log(people[i].firstName+","+people[i].lastName)
    }
    var city = {
        "name": "中国",
        "province": [{
            "name": "黑龙江",
            "cities": {
                "city": ["哈尔滨", "大庆"]
            }
        }, {
            "name": "广东",
            "cities": {
                "city": ["广州", "深圳", "珠海"]
            }
        }, {
            "name": "台湾",
            "cities": {
                "city": ["台北", "高雄"]
            }
        }, {
            "name": "新疆",
            "cities": {
                "city": ["乌鲁木齐"]
            }
        }]
    };
    var province = city.province;
    for (let i = 0; i < province.length; i++){
        console.log(province[i].name+ province[i].cities)
    }

</script>
</html>